<template>
    <component ref="Element" :is="ObjectItem" :Model="Model" :DefaultValue="DefaultValue" :Level="Level" />
</template>
<script setup>
import { shallowRef, ref } from 'vue'
import ObjectDefault from './ObjectDefault.vue';
import ObjectDialog from './ObjectDialog.vue';


// 获取子组件类型
const ObjectItem = shallowRef();
const ObjectMapping = {
    Default: ObjectDefault,
    Dialog: ObjectDialog,
}
const props = defineProps(['Model', 'Type', 'Level', 'DefaultValue']);
ObjectItem.value = ObjectMapping[props.Type];

const Element = ref();

const GetValue = function () {
    return Element.value.GetValue()
}

const SetValue = function () { }


defineExpose({ GetValue, SetValue })


</script>
<style lang="less" scoped>
.Title {
    padding: 4px 15px;
    font-size: 16px;
    border-bottom: 1px solid #CCC;
    margin-bottom: 10px;
}
</style>